﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.IO;

namespace DocumentsTagger.UI
{
    public class GetFileSysemInformationConverter: IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            object returnValue = null;
            try
            {
                if (value is DriveInfo)
                { 
                    return ((DriveInfo)value).RootDirectory.GetDirectories();
                }
                else if (value is DirectoryInfo)
                {
                    returnValue = ((DirectoryInfo)value).GetDirectories();
                }
                else
                {
                    returnValue = null;
                }
            }
            catch (Exception ex)
            { 
                // TODO - add system log.
            }
            return returnValue;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }


}
